﻿using System.Configuration;

namespace Yz.Base.Dal
{
    public class DBConstant
    {

        /// <summary>
        ///     判断连接字符串是否包含密码
        /// </summary>
        /// <param name="connStr"></param>
        /// <returns></returns>
        public static bool IsConnStrHasPwd(string connStr)
        {
            return connStr.Contains("pwd");
        }

        #region 数据库连接字符串


        /// <summary>
        /// Yz数据库连接字符串
        /// </summary>
        public static string YzConnStr => ConfigurationManager.ConnectionStrings[DBContextName.YzContext].ConnectionString;
        /// <summary>
        /// 定时程序数据库连接字符串
        /// </summary>
        public static string HangfireConnStr => ConfigurationManager.ConnectionStrings[DBContextName.Hangfire].ConnectionString;
        #endregion
    }
    /// <summary>
    /// 数据库连接name集合
    /// </summary>
    public struct DBContextName
    {
        /// <summary>
        ///  数据连接name
        /// </summary>
        public const string YzContext = "YzContext";
        /// <summary>
        /// 定时程序
        /// </summary>
        public const string Hangfire = "Hangfire";
    }
}
